package 生产者消费者;

public class ProductConsumerTest {

    public static void main(String[] args) {
        Resource r=new Resource();
        new Thread(()->{
            try{
                while (true){
                    r.producer();
                    Thread.sleep(1);
                }
            }catch (InterruptedException e){
                e.printStackTrace();
            }
        }/*,*"生活者"*/).start();

        new Thread(()->{
            try{
                while (true){
                    r.consumer();
                    Thread.sleep(1);
                }
            }catch (InterruptedException e){
                e.printStackTrace();
            }
        }/*,"消费者"*/).start();
    }

}
